package sample4.provider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author YUN
 */
public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    /**
     * コンストラクタ
     * 
     * @param context
     */
    public MySQLiteOpenHelper(Context context) {
        super(context, MyDatabase.DATABASE_NAME, null, MyDatabase.DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        new MyDatabase.MyTable().create(db);
        new MyDatabase.MyView().create(db);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        new MyDatabase.MyTable().drop(db);
        new MyDatabase.MyView().drop(db);
        onCreate(db);
    }
}
